def main():
    correct_username = "root"
    correct_password = "123456"

    max_attempts = 3
    attempts = 0

    while attempts < max_attempts:
        username = input("请输入用户名: ")
        password = input("请输入密码: ")

        if username == correct_username and password == correct_password:
            print("登录成功！")
            return
        else:
            attempts += 1
            print(f"用户名或密码错误，请重试（您还有 {max_attempts - attempts} 次机会）")

    print("登录失败，您已经用完了所有重试机会。")


if __name__ == "__main__":
    main()
